/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
 * Description: 上机编程认证
 * Note: 缺省代码仅供参考，可自行决定使用、修改或删除
 */
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cstdint>
#define MaxValue INT64_C(1) << 32
#define MinValue INT32_MIN
using namespace std;

class Solution {
public:
    // 待实现函数，在此函数中填入答题代码;
    string GetHexString(long long input) {
        if (input < MinValue || input >= MaxValue) {
            return "overflow";
        }

        int32_t int32Value = static_cast<int32_t>(input);
        string result;
        ostringstream oss;
        oss << hex << uppercase << setw(8) << setfill('0') << int32Value;
        string chars = oss.str();

        //大端序
        for (int i = 0; i <= 6; i += 2) {
            result.append(chars.substr(i, 2) + " ");
        }
        result.pop_back();
        result.append("\n");

        //小端序
        for (int i = 6; i >= 0; i -= 2) {
            result.append(chars.substr(i, 2) + " ");
        }
        result.pop_back();
        return result;
    }
};

int main() {
    long long input;
    cin >> input;
    Solution solu;
    string result = solu.GetHexString(input);
    cout << result;
    return 0;
}
